package net.pimpas.lock.tests;

import java.util.concurrent.locks.ReentrantLock;

public class LockTestMain {
	
	private static final ReentrantLock lock = new ReentrantLock();
	
	public void lock( ) {
		try {
			lock.lockInterruptibly();
		} catch (InterruptedException e) {
		}
	}
	
	public void unLock( ) {
		lock.unlock();
	}
	
	public static void main(String[] args) {
		
		new Thread() {
			@Override
			public void run() {
				LockTestMain m = new LockTestMain();
				m.lock();
			}
		}.start();
		try {
			Thread.sleep(400);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		new Thread() {
			@Override
			public void run() {
				LockTestMain m = new LockTestMain();
				m.lock();
			}
		}.start();
	}
}